from langdev_helper.util.search import *
from langdev_helper.util.url import *
import json
from bs4 import BeautifulSoup as Soup
from langchain_community.document_loaders.recursive_url_loader import RecursiveUrlLoader
from langchain_core.prompts import PromptTemplate
from langdev_helper.prompt.summary import *
from langdev_core.llms.qianfan import call_llm

results = search_with_bing('大语言模型')

for result in results:
    # print(result)
    print(result['abstract'])
    print(result['link'])
    print("\n")

t_ret = results[-3]
test_url = t_ret['link']
test_desc= t_ret['abstract']
print(test_url, "\n",test_desc)

docs = load_url(test_url)
# print(docs)

print(prompt_summary)

prompt_template = PromptTemplate.from_template(prompt_summary)
pt = prompt_template.format(number=100, content=docs)

print(pt)

res = call_llm(pt)
print(res)
